<?php

include_once "function_xml_basic.php";

$root_path = "/MINI/RESOURCES/OBJECTS/BINDCLASS";

function GetXmlBindObjectByName($name)
{
	$ret_array = GetXmlBindObjectList();
    
        foreach ($ret_array as $ret)
        {   
                if ($ret['Name'] == $name)
                        return $ret;
        }   
        return NULL;

}

function GetXmlBindObjectList()
{
	$root_path = "/MINI/RESOURCES/OBJECTS/BINDCLASS";
	//print "Root Path:". $root_path. "\n";
	$query_string = $root_path. "/WIDTH/OBJECT";
	$key_array = array('Name', 'ObjectType', 'Proi', 'NeedWidth', 'MaxWidth', 'Note');
	return GetAttributList($query_string, $key_array);
}

function DelXmlSpecialOneBindObject($name)
{
	global $root_path;

	$query_string = $root_path. "/WIDTH/OBJECT[@Name='". $name. "']";
	DelSpecialNode($query_string);
}

function AppendXmlBindObject($in_array)
{
	global $root_path;
        $node_name = "OBJECT";
	$query_string = $root_path. "/WIDTH";
	$in_array['ObjectType'] = "1";
	AppendAllAttrOfNode($query_string, $node_name, $in_array);
}

function SetXmlBindObject($in_array)
{
	global $root_path;
	$name = $in_array['Name'];
	$in_array['ObjectType'] = "1";
	$query_string = $root_path. "/WIDTH/OBJECT[@Name='". $name. "']";
	EditAllAttrOfNode($query_string, $in_array);
}

function GetXmlFilterObjectByName($name)
{
	$ret_array = GetXmlFilterObjectList();
    
        foreach ($ret_array as $ret)
        {   
                if ($ret['Name'] == $name)
                        return $ret;
        }   
        return NULL;

}

function GetXmlFilterObjectList()
{
	$root_path = "/MINI/RESOURCES/OBJECTS/BINDCLASS";
	$query_string = $root_path. "/FILTER/OBJECT";
	$key_array = array('Name', 'ObjectType', 'Filter', 'Value1', 'Value2', 'Note');
	return GetAttributList($query_string, $key_array);
}

function DelXmlSpecialOneFilterObject($name)
{
	global $root_path;

	$query_string = $root_path. "/FILTER/OBJECT[@Name='". $name. "']";
	DelSpecialNode($query_string);
}

function AppendXmlFilterObject($in_array)
{
	global $root_path;
        $node_name = "OBJECT";
	$query_string = $root_path. "/FILTER";
	$in_array['ObjectType'] = "1";
	AppendAllAttrOfNode($query_string, $node_name, $in_array);
}

function SetXmlFilterObject($in_array)
{
	global $root_path;
	$name = $in_array['Name'];
	$in_array['ObjectType'] = "1";
	$query_string = $root_path. "/FILTER/OBJECT[@Name='". $name. "']";
	EditAllAttrOfNode($query_string, $in_array);
}
?>
